import { createApp } from 'vue'
import App from './App.vue'
import { createPinia } from 'pinia'
import router from './router'
import ElementPlus from 'element-plus'
import { download, exportTableToExcel } from '@/utils/download'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import { basicSetup } from 'codemirror'
import { sql } from '@codemirror/lang-sql'
import * as Sentry from "@sentry/vue";
import formCreate from '@form-create/element-ui'; // 引入 FormCreate
import './style.css'
import VueCodemirror from 'vue-codemirror'
import { v4 as uuidv4 } from 'uuid';
// import { useDict } from '@/utils/dict'
import { cityList } from "@/utils/enum";



const app = createApp(App)
app.use(VueCodemirror, {
    autofocus: true,
    disabled: false,
    indentWithTab: true,
    tabSize: 2,
    placeholder: '输入代码',
    extensions: [basicSetup, sql()]
})
app.use(ElementPlus, {
    locale: zhCn,
}).use(formCreate)

//Sentry 监控平台
//打包后执行npx @sentry/wizard@latest -i sourcemaps --saas
// process.env.NODE_ENV === 'production' && Sentry.init({
//     app,
//     dsn: "https://92f68262cc8dde1ea51a5c9930548df8@o4508572616032256.ingest.us.sentry.io/4508572634120192",
//     integrations: [
//         Sentry.browserTracingIntegration({ router }),
//         Sentry.replayIntegration(),
//     ],
//     environment: process.env.NODE_ENV,
//     // Tracing
//     tracesSampleRate: 1.0, //  Capture 100% of the transactions
//     // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
//     tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
//     // Session Replay
//     replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
//     replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
// });
app.use(createPinia())
app.use(router)
app.config.globalProperties.download = download
app.config.globalProperties.exportTableToExcel = exportTableToExcel
app.config.globalProperties.$filters = {
    cxjldataStatus(value) {
        const dataStatusDict = ['草稿', '不同意', '驳回修改', '待预审', '预审通过', '审批通过']
        return dataStatusDict[value] || value
    }
}
app.config.globalProperties.$cityList = cityList

app.mount('#app')
